using System.ComponentModel.DataAnnotations;
using FytSoa.Common.Enum;
using FytSoa.Domain.Hr;
using SqlSugar;

namespace FytSoa.Domain.Crm;

/// <summary>
/// 项目任务
/// </summary>
[SugarTable("crm_project_task")]
public class CrmProjectTask:Entity
{
    /// <summary>
    /// 任务编号
    /// </summary>
    [Required]
    [StringLength(20)]
    public string Number { get; set; }
    
    /// <summary>
    /// 任务主题
    /// </summary>
    [Required]
    [StringLength(200)]
    public string Name { get; set; }

    /// <summary>
    /// 项目编号
    /// </summary>
    [Required]
    public long ProjectId { get; set; }
    
    /// <summary>
    /// 项目信息
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(ProjectId))]
    public CrmProject Project { get; set; }

    /// <summary>
    /// 阶段编号
    /// </summary>
    [Required]
    public long StageId { get; set; } = 0;
    
    /// <summary>
    /// 阶段信息
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(StageId))]
    public CrmProjectStage Stage { get; set; }

    /// <summary>
    /// 优先级编号
    /// </summary>
    [Required]
    public string Level { get; set; }

    /// <summary>
    /// 负责人编号
    /// </summary>
    [Required]
    public long ManagerEmployeeId { get; set; }
    
    /// <summary>
    /// 负责人
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(ManagerEmployeeId))]
    public HrEmployee ManagerEmployee { get; set; }

    /// <summary>
    /// 其他成员
    /// </summary>
    [StringLength(500)]
    public string OtherEmployee { get; set; }

    /// <summary>
    /// 项目状态
    /// </summary>
    public CrmProjectTaskStatusEnum Status { get; set; } = 0;

    /// <summary>
    /// 开始时间
    /// </summary>
    public DateTime? StartTime { get; set; }

    /// <summary>
    /// 结束时间
    /// </summary>
    public DateTime? EndTime { get; set; }

    /// <summary>
    /// 标签
    /// </summary>
    [SugarColumn(IsJson = true)]
    public List<string> Tag { get; set; } = new();

    /// <summary>
    /// 子任务
    /// </summary>
    public string SubTask { get; set; }
    
    /// <summary>
    /// 附件
    /// </summary>
    [SugarColumn(IsJson = true)]
    public List<FileBase> Files { get; set; } = new();

    /// <summary>
    /// 任务详细
    /// </summary>
    public string Remark { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    public string CreateUser { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreateTime { get; set; }

    /// <summary>
    /// 更新人
    /// </summary>
    public string UpdateUser { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdateTime { get; set; }


}